<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>答题闯关王</title>
    <link rel="shortcut icon" href="__STATIC__/favicon.ico"/>
    <link href="__STATIC__/css/index/index.css" type="text/css" rel="stylesheet">
    <link href="__STATIC__/css/index/iconfont/iconfont.css" type="text/css" rel="stylesheet">
	<link href="__STATIC__/layui/css/layui.css" type="text/css" rel="stylesheet">
	<script src="__STATIC__/js/jquery-3.3.1.js" type="application/javascript"></script>
	<script src="__STATIC__/layui/layui.all.js" type="application/javascript"></script>
	<style>
		.desktop .order-box table tbody tr td {
			text-align: center;
		}
		.desktop .order-box table tbody tr td input{
			text-align: center;
		}
		input{
			height: 20px;
		}
	</style>
</head>
<body>
	<div class="desktop item-wrapper">
		<div class="desktop-main">
			<div class="order-box">
				<table cellspacing="0" ng-show="docArr.length>0">
					<thead>
						<tr>
							<td>id</td>
							<td>默认答题机会</td>
							<td>答题规则</td>
							<td>答题时间</td>
							<td>操作</td>
						</tr>
					</thead>
					<tbody id="order-table">
						<tr>
							<form id=addForm' type="post">
								{volist name="ares" id="ares"}
									<input type="hidden" name="id" value="{$ares.id}">
									<td>{$ares.id}</td>
									<td><input  type="text" size="20%" name="answer_opportunity" id="ay" value="{$ares.answer_opportunity}"></td>
									<td><input type="text" size="50" name="rule" id="rule" value="{$ares.rule}"></td>
									<td><input type="text" size="10%" name="A_time" id="at" value="{$ares.A_time}"></td>
									<td><input type="button" class="layui-btn layui-btn-xs" value="保存" onclick="btn()"></td>
								{/volist}
							</form>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
	</div>
    <div class="global-tips">
        <p></p>
    </div>
</body>
<script>
function btn() {
    var answer_opportunity = $("#ay").val();
    var rule = $("#rule").val();
    var A_time = $("#at").val();
    $.ajax({
        url:"{:url('Form/updateanswer')}",
        type:"post",
        data: {answer_opportunity:answer_opportunity,rule:rule,A_time:A_time},
        success:function(result){
            if (result = 1) {
                layer.msg('修改成功');
             }else{
                layer.msg('修改失败');
			 }
        }
	})
}
</script>
</html>